#ifndef COLLISION_SUBJECT_H
#define COLLISION_SUBJECT_H

#include <map>
#include <vector>

#include "SFML/System.hpp"

#include "CollisionType.h"
#include "Entity.h"

class CollisionListener;

class CollisionSubject
{
public:
    virtual ~CollisionSubject();

    CollisionSubject& operator=(const CollisionSubject& rhs);

    // Registers the listener for collision types of collisionType.
    virtual void registerListener(CollisionListener* listener, CollisionType collisionType);
    virtual void unregisterListener(CollisionListener* listener);
protected:
    virtual void notifyListenersOfCollision(EntityPtr entity1, EntityPtr entity2,
        CollisionType collisionType);

    typedef std::vector<CollisionListener*> listener_vec;
    typedef std::map<CollisionType, listener_vec> listener_map;
    typedef listener_vec::iterator listener_vec_it;
    typedef listener_map::iterator listener_map_it;

    listener_map listeners;
};

#endif